private subroutine Sorted(estdist, neighbors)
A subroutine to retrieve the nearest neighbors of the estimation location
referred to as control points. The observations separation matrix is
returned (as a precursor to producing the observations covariance matrix)
along with the vector of nearest neighbbors.
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
type(site),
|
intent(inout), |
|
DIMENSION(:)
|
:: |
estdist |
|
integer(kind=short),
|
intent(in) |
|
|
:: |
neighbors |
|
Variables
Type |
Visibility | Attributes |
|
Name |
| Initial | |
integer,
|
public |
|
:: |
i |
|
|
|
integer,
|
public |
|
:: |
j |
|
|
|
integer,
|
public |
|
:: |
p1 |
|
|
|
integer,
|
public |
|
:: |
p2 |
|
|
|
Source Code
SUBROUTINE Sorted &
!
( estdist, neighbors )
IMPLICIT NONE
!Arguments with intent(in):
INTEGER (KIND = short), INTENT(IN) :: neighbors
!Arguments with intent(inout):
TYPE(site),DIMENSION(:),INTENT(inout) :: estdist
!Local variable declarations
INTEGER :: i,j,p1,p2
!------------------------------------end of declarations-----------------------
!Sort estdist by h (distance) to find the nearest neighbors of the prediction location
CALL Sort (estdist,0)
!Select control points for kriging: the n nearest neighbors
controlpts = estdist(1:neighbors)
!Construct observations distance matrix (hobs) from the control points
DO i=1,neighbors
DO j=1,neighbors
p1=controlpts(i)%oid
p2=controlpts(j)%oid
hobs(i,j)=obsdist(p1,p2)
END DO
END DO
END SUBROUTINE Sorted